home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tclX-6.4 / help / intro / built-in-vars < prev    next >
Encoding:
Text File  |  1992-12-17  |  5.3 KB  |  96 lines

  1.      BUILT-IN VARIABLES
  2.           The following  global  variables  are  created  and  managed
  3.           automatically by the Tcl library.  Except where noted below,
  4.           these variables should normally be treated as  read-only  by
  5.           application-specific code and by users.
  6.  
  7.           env
  8.                This variable is maintained by Tcl as  an  array  whose
  9.                elements are the environment variables for the process.
  10.                Reading  an  element  will  return  the  value  of  the
  11.                corresponding environment variable.  Setting an element
  12.                of the array will modify the corresponding  environment
  13.                variable  or  create  a  new  one if it doesn't already
  14.                exist.  Unsetting an element of  env  will  remove  the
  15.                corresponding environment variable.  Changes to the env
  16.                array will affect the environment passed to children by
  17.                commands  like  exec.  If the entire env array is unset
  18.                then Tcl will stop monitoring env accesses and will not
  19.                update environment variables.
  20.  
  21.           errorCode
  22.                After  an error has occurred, this variable will be set
  23.                to hold additional information about  the  error  in  a
  24.                form  that is easy to process with programs.  errorCode
  25.                consists of a Tcl list with one or more elements.   The
  26.                first element of the list identifies a general class of
  27.                errors, and determines the format of the  rest  of  the
  28.                list.   The following formats for errorCode are used by
  29.                the  Tcl  core;  individual  applications  may   define
  30.                additional formats.
  31.  
  32.                CHILDKILLED pid sigName msg
  33.                     This  format is used when a child process has been
  34.                     killed because of a signal.  The second element of
  35.                     errorCode  will  be  the  process's identifier (in
  36.                     decimal).  The third element will be the  symbolic
  37.                     name  of  the  signal  that  caused the process to
  38.                     terminate; it will be one of the  names  from  the
  39.                     include  file  signal.h,  such  as  SIGPIPE.   The
  40.                     fourth element  will  be  a  short  human-readable
  41.                     message  describing the signal, such as ``write on
  42.                     pipe with no readers'' for SIGPIPE.
  43.  
  44.  
  45.                CHILDSTATUS pid code
  46.                     This  format  is  used  when  a  child process has
  47.                     exited with a non-zero exit  status.   The  second
  48.                     element   of   errorCode  will  be  the  process's
  49.                     identifier (in decimal) and the third element will
  50.                     be  the exit code returned by the process (also in
  51.                     decimal).
  52.  
  53.                CHILDSUSP pid code
  54.                     This  format is used when a child process has been
  55.                     suspended because of a signal.  The second element
  56.                     of  errorCode will be the process's identifier, in
  57.                     decimal.  The third element will be  the  symbolic
  58.                     name  of  the  signal  that  caused the process to
  59.                     suspend; this will be one of the  names  from  the
  60.                     include  file  signal.h,  such  as  SIGTTIN.   The
  61.                     fourth element  will  be  a  short  human-readable
  62.                     message    describing    the   signal,   such   as
  63.                     ``background tty read'' for SIGTTIN.
  64.  
  65.                NONE
  66.                     This format is used for errors where no additional
  67.                     information is available for an error besides  the
  68.                     message  returned  with the error.  In these cases
  69.                     errorCode will consist  of  a  list  containing  a
  70.                     single element whose contents are NONE.
  71.  
  72.                UNIX errName msg
  73.                     If  the  first  element of errorCode is UNIX, then
  74.                     the error occurred during a UNIX kernel call.  The
  75.                     second  element  of  the  list  will  contain  the
  76.                     symbolic name of the error that occurred, such  as
  77.                     ENOENT;  this will be one of the values defined in
  78.                     the include file errno.h.  The  third  element  of
  79.                     the   list   will   be  a  human-readable  message
  80.                     corresponding to errName, such as ``no  such  file
  81.                     or directory'' for the ENOENT case.
  82.  
  83.                To  set  errorCode,  applications  should  use  library
  84.                procedures  such as Tcl_SetErrorCode and Tcl_UnixError,
  85.                or they may invoke the error command.  If one of  these
  86.                methods hasn't been used, then the Tcl interpreter will
  87.                reset the variable to NONE after the next error.
  88.  
  89.           errorInfo
  90.                After an error has occurred, this string  will  contain
  91.                one  or  more  lines  identifying  the Tcl commands and
  92.                procedures that  were  being  executed  when  the  most
  93.                recent error occurred.  Its contents take the form of a
  94.                stack trace showing the  various  nested  Tcl  commands
  95.                that had been invoked at the time of the error.
  96.